package Text_89;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.function.Function;

public class Code {

	public static void main(String[] args) {
		 ArrayList<String> list = new ArrayList<>();
	        Collections.addAll(list,"杨生,11","杨素,22","双儿,33","黄蓉,44","小龙女,55","杨杨,66");
	        list.stream().map(new Function<String, Student>() {
	            @Override
	            public Student apply(String s) {
	                String[] split = s.split(",");
	                String name = split[0];
	                int age = Integer.parseInt(split[1]);
	                return new Student(name,age);
	            }
	        }).forEach(student -> System.out.println(student));
	        System.out.println("==============");
	        Student[] arr = list.stream().map(Student::new).toArray(Student[]::new);
	        System.out.println(Arrays.toString(arr));

	}

}
